Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plane: Quadplane: rework assistance check #26318

Merged
merged 7 commits into from
Apr 22, 2024

Conversation

IamPete1
Copy link
Member

This reworks the assistance check into a new sub class. There are also a number of functional changes:

  • This more carefully resets the assistance state if not in a mode that checks assistance. Currently if you trigger alt assist and enter a VTOL mode and then re-enter FW at a later point while still under the set alt you will get no delay and no second warning message because the in_alt_assist and alt_error_start_ms are not cleared.
  • Force flare no longer changes the assist state, instead assist checks for force flare. This means that the state is still where the user left it after the flare is done.
  • All types of assist are checked at once. Currently we stop checking when the assistance should be triggered. This means in speed assist altitude is not checked. We have a delay for altitude assist and angle, so it is possible to come out of speed assist briefly before starting alt assist.
  • This adds a clear delay of double the set trigger delay (angle and alt only). This prevents a momentary clearing of the threshold from stopping assistance. We currently have a trigger delay and no clear delay, so if oscillating around the threshold we favor not assisting this change means we favor assisting.

This will need a fair bit of testing, so far it has had none. I have opened the PR so we can get consensus on the desired behavior.

We might also want to re-work the messages, currently you can get a alt assisting message while still in speed assistance, we might want the messages to behave as before, so as soon as the speed is reached the alt assistance message is given. However it is quite nice to get the message early, it saves attempting the transition only to reach your set speed and find your too low.

We might also want to re-issue the angle and alt assistance warnings periodically.

A followup PR could move all these functions into a new file, quadplane.cpp it is getting big....

@IamPete1
Copy link
Member Author

Added logging of the various states to the QTUN message, the existing assist uint8 becomes a flags bitmask, so no increase in log size.

@IamPete1
Copy link
Member Author

IamPete1 commented Feb 25, 2024

A normal transition, assist enabled and speed until speed reached, then just assist enabled:
image

Alt assist example changing the threshold to fake low alt with a 10 seconds assist delay to show the triggering and clearing timeouts:
image

A too low transition. First assistance + speed. Then assistance + speed + alt once the delay has elapsed. Then speed is reached so assistance + alt.
image

@IamPete1 IamPete1 marked this pull request as ready for review February 25, 2024 17:54
@IamPete1 IamPete1 requested a review from tridge February 25, 2024 17:54
@IamPete1 IamPete1 force-pushed the qp_assist_rework branch 2 times, most recently from 4694399 to f836967 Compare March 7, 2024 20:26
@IamPete1
Copy link
Member Author

IamPete1 commented Mar 7, 2024

Rebased and updated assist autotest to check alt assist and transition fail action.

@IamPete1
Copy link
Member Author

IamPete1 commented Mar 7, 2024

To see what it might look like the last commit moves the assist functionality into new files.

@tridge
Copy link
Contributor

tridge commented Apr 1, 2024

I like the concept, but needs a bunch of testing

@IamPete1
Copy link
Member Author

Rebased.

@IamPete1
Copy link
Member Author

Tested all types of assist with Alti Transition in realflight. All working as expected. Log here: https://drive.google.com/file/d/1sLEzbqd3NTciKZ3HMAg2rtyuZozzm02N/view?usp=sharing

@tridge tridge merged commit 2ee5cdd into ArduPilot:master Apr 22, 2024
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants